// 引入request函数
import request from "@/utils/request";

// 引入分类列表的接口类型
import type { CategoryListModel } from "./model/categoryModel";

// 定义枚举类型的接口地址
enum API {
  GetCategory1List = "/admin/product/getCategory1",
  GetCategory2List = "/admin/product/getCategory2",
  GetCategory3List = "/admin/product/getCategory3",
}

//获取一级分类列表数据 ， 不用传递参数
export const reqGetcategory1List = () => request.get<any, CategoryListModel>(API.GetCategory1List);

// 获取二级分类列表数据， 需要一级分类的id
export const reqGetcategory2List = (category1Id: number) => request.get<any, CategoryListModel>(`${API.GetCategory2List}/${category1Id}`);

// 获取三级分类列表数据， 需要二级分类的id
export const reqGetcategory3List = (category2Id: number) => request.get<any, CategoryListModel>(`${API.GetCategory3List}/${category2Id}`);
